﻿using System;
using ApplicationConfiguration;
using GameBoard;

namespace CombatAutomationTheater
{
    internal class MainConfigurationSettingsViewModel : BaseAppSettingsViewModel
    {
        private static MainConfigurationSettingsViewModel _instance;
        private bool _autoSaveEachTurn;
        private bool _lockCameraRotation;
        private bool _rerollInitiativeEachRound;

        private MainConfigurationSettingsViewModel()
        {
            LoadAppConfigInfo();
        }


        public static MainConfigurationSettingsViewModel Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new MainConfigurationSettingsViewModel();
                }
                return _instance;
            }
        }

        public bool AutoSaveEachTurn
        {
            get { return _autoSaveEachTurn; }
            set
            {
                _autoSaveEachTurn = value;
                OnPropertyChanged("AutoSaveEachTurn");
            }
        }

        public bool OrientAllCamerasToMatchMain
        {
            get { return VisualsViewModel.Instance.OrientAllCamerasToMatchMain; }
            set
            {
                VisualsViewModel.Instance.OrientAllCamerasToMatchMain = value;
                OnPropertyChanged("OrientAllCamerasToMatchMain");
            }
        }

        public bool LockCameraRotation
        {
            get { return _lockCameraRotation; }
            set
            {
                _lockCameraRotation = value;
                OnPropertyChanged("LockCameraRotation");
                VisualsViewModel.Instance.LockRotation = _lockCameraRotation;
            }
        }

        public bool RerollInitiativeEachRound
        {
            get { return _rerollInitiativeEachRound; }
            set
            {
                _rerollInitiativeEachRound = value;
                OnPropertyChanged("RerollInitiativeEachRound");
            }
        }

        private String _systemFilter = "All";
        public String SystemFilter
        {
            get { return _systemFilter; }
            set
            {
                _systemFilter = value;
                OnPropertyChanged("SystemFilter");
            }
        }
    }
}